import { getTreeSelectApi } from "@/api/system/role";
import type { AvueTreeOption } from "@smallwei/avue";
import { ref } from "vue";

function useMenuTree() {
  const treeOption: AvueTreeOption = {
    addBtn: false,
    multiple: true,
    filter: false,
    props: {
      label: "menuName",
      value: "id",
    },
    nodeKey: "id",
  };
  const treeData = ref<any>([]);
  const checkChange = {};

  async function initMenuTree() {
    const { data } = await getTreeSelectApi();
    treeData.value = data;
  }

  return { treeOption, treeData, checkChange, initMenuTree };
}

export default useMenuTree;
